algalcommand.io
Class XMLWriter

java.lang.Object
  extended by algalcommand.io.XMLWriter

public abstract class XMLWriter
extends java.lang.Object

Uses code from the example at http://download.oracle.com/javaee/1.4/tutorial/doc/JAXPXSLT4.html.


Field Summary
static int INDENT_SIZE
           
 
Constructor Summary
XMLWriter()
           
 
Method Summary
static void main(java.lang.String[] args)
          for testing only
static org.w3c.dom.Document makeXMLDocument()
          Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)
static org.w3c.dom.Element makeXMLElement(java.lang.String tag, org.w3c.dom.Document xmldoc)
          Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)
static java.lang.String SafeXMLString(org.w3c.dom.Node tree)
          Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)
static void writeXML(org.w3c.dom.Node tree, java.io.OutputStream out)
          Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)
static void writeXML(org.w3c.dom.Node tree, java.io.Writer out)
          Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)
static java.lang.String XMLString(org.w3c.dom.Node tree)
          Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDENT_SIZE

public static final int INDENT_SIZE
See Also:
Constant Field Values
Constructor Detail

XMLWriter

public XMLWriter()
Method Detail

SafeXMLString

public static java.lang.String SafeXMLString(org.w3c.dom.Node tree)
                                      throws javax.xml.transform.TransformerConfigurationException,
                                             javax.xml.transform.TransformerException
Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)

Takes a Node from an XML tree and writes a string of XML that could go in a text file as an XML document. This method is "safe" because it gives the resposibility of handling exceptions to the invioking object.

Parameters:
tree - A DOM tree.
Returns:
A string formatted for XML representing the provided DOM tree.
Throws:
javax.xml.transform.TransformerConfigurationException - Thrown if the implementation is not available or cannot be instantiated.
javax.xml.transform.TransformerException - If an unrecoverable error occurs during the course of the transformation from data tree to XML text.

writeXML

public static void writeXML(org.w3c.dom.Node tree,
                            java.io.Writer out)
                     throws javax.xml.transform.TransformerConfigurationException,
                            javax.xml.transform.TransformerException
Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)

Takes a Node from an XML tree and writes the XML text representation to the provided output writer.

Parameters:
tree - The root node af an XML DOM tree
out - A writer, such as a FileWriter, that you want to write the XML to.
Throws:
javax.xml.transform.TransformerConfigurationException - Thrown if the implementation is not available or cannot be instantiated.
javax.xml.transform.TransformerException - If an unrecoverable error occurs during the course of the transformation from data tree to XML text.

writeXML

public static void writeXML(org.w3c.dom.Node tree,
                            java.io.OutputStream out)
                     throws javax.xml.transform.TransformerConfigurationException,
                            javax.xml.transform.TransformerException
Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)

Takes a Node from an XML tree and writes the XML text representation to the provided output stream.

Parameters:
tree - The root node af an XML DOM tree
out - An output stream, such as System.out, that you want to write the XML to.
Throws:
javax.xml.transform.TransformerConfigurationException - Thrown if the implementation is not available or cannot be instantiated.
javax.xml.transform.TransformerException - If an unrecoverable error occurs during the course of the transformation from data tree to XML text.

XMLString

public static java.lang.String XMLString(org.w3c.dom.Node tree)
Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)

Takes a Node from an XML tree and writes a string of XML that could go in a text file as an XML document. If there is a problem with the XML libraries, then a null String is returned and the exception message is sent to the standard error output.

Parameters:
tree - A DOM tree.
Returns:
A string formatted for XML representing the provided DOM tree, or null if there was a problem.

makeXMLElement

public static org.w3c.dom.Element makeXMLElement(java.lang.String tag,
                                                 org.w3c.dom.Document xmldoc)
Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)

A convienience method for making XML nodes.

Parameters:
tag - The tag name, as in <tag />
xmldoc - The org.w3c.dom.Document that will own this Element
Returns:
A new XML element.

makeXMLDocument

public static org.w3c.dom.Document makeXMLDocument()
Deprecated. Will be discontinuing the use of SAX parsers (due to lack of thread safety)


main

public static void main(java.lang.String[] args)
for testing only